package com.tencent.sr.iris.basic.mp.restapi.controller;

import com.tencent.sr.iris.basic.mp.dependency.CommonConfigDependency;
import com.tencent.sr.iris.basic.service.interfaces.request.CommonConfigForceRequest;
import com.tencent.sr.iris.basic.service.interfaces.response.CommonConfigResponse;
import com.tencent.sr.rmall.common.primitive.HttpResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.annotation.Resource;
import javax.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@Api("通用配置相关接口")
@RequestMapping("/iris/basic/mp/v1/config")
public class CommonConfigController {
    @Resource
    private CommonConfigDependency commonConfigDependency;

    @ApiOperation("小程序查询生效配置计划")
    @PostMapping("queryForceConfigs")
    HttpResult<List<CommonConfigResponse>> queryForceConfigs(@Valid @RequestBody CommonConfigForceRequest request) {
        log.info("CommonConfigController queryForceConfigs req:{}", request);
        return HttpResult.succ(commonConfigDependency.queryForceConfigs(request));
    }
}
